package rickyGame.game.skill
{
	import rickyGame.model.config.*;

	/**
	 * 玩家技能数据
	 */
	public class SkillData
	{
		public function SkillData()
		{
			
		}
		
		/**
		 * 从配置文件装载数据
		 */
		public function load(ability:Ability,level:int=1):void
		{
			_abilityID=ability.abilityID//技能id
			_category=ability.category;//技能类别(单位技能，建筑技能。。);
			_name=ability.name;//技能名称
			_release=ability.release;
			_actAnim=ability.actAnim;
			_model=ability.model;//技能模型
			_animProps=ability.animProps.split(",");
			_icon=ability.icon;//技能icon
			_level=level;//技能等级
			_comments=ability.comments;//技能说明
			_auto=ability.auto;//自动释放
			_passive=ability.passive;//
			
			var abdata:AbilityData;
			if(level>=ability.dataArr.length)
				level=ability.dataArr.length;
			
			abdata=ability.dataArr[level-1];
			_miniCastSkillDistance=abdata.miniCastSkillDistance;//最小释放距离
			_maxCastSkillDistance=abdata.maxCastSkillDistance;//最大释放距离
			_cooldown=abdata.cooldown;//冷却时间
			_effectTarget=abdata.effectTarget;//影响目标类型
			_effectRange=abdata.effectRange;//影响范围
			_continueTime=abdata.continueTime;//持续时间
			_spellTarget=abdata.spellTarget;//释放目标
			_effectInterval=abdata.effectInterval;//影响间隔
			_waitTime=abdata.waitTime;//等待时间
			_cast=abdata.cast;//使用消耗
			_effect=abdata.effect;//影响特效
			_effects=_effect.split(",");//影响
			_description=abdata.description;
			_parameter=abdata.parameter;//弹道
			_parameter1=abdata.parameter1;
		}
		
		//*********************************************
		// 主属性
		//*******************************************
		/**
		 * 技能id
		 */
		public function get abilityID():String
		{
			return _abilityID;
		}
		
		/**
		 * @private
		 */
		public function set abilityID(value:String):void
		{
			_abilityID = value;
		}
		
		/**
		 * 技能类别(单位技能，建筑技能。。)
		 */
		public function get category():String
		{
			return _category;
		}
		
		/**
		 * @private
		 */
		public function set category(value:String):void
		{
			_category = value;
		}
		
		/**
		 * 技能名称
		 */
		public function get name():String
		{
			return _name;
		}
		
		/**
		 * @private
		 */
		public function set name(value:String):void
		{
			_name = value;
		}
		
		/**
		 * 技能模型
		 */
		public function get model():String
		{
			return _model;
		}
		
		/**
		 * @private
		 */
		public function set model(value:String):void
		{
			_model = value;
		}
		
		/**
		 * 动画属性
		 */
		public function get animProps():Array
		{
			return _animProps;
		}
		
		/**
		 * @private
		 */
		public function set animProps(value:Array):void
		{
			_animProps = value;
		}
		
		/**
		 * 技能icon
		 */
		public function get icon():String
		{
			return _icon;
		}
		
		/**
		 * @private
		 */
		public function set icon(value:String):void
		{
			_icon = value;
		}
		
		/**
		 * 技能等级
		 */
		public function get level():int
		{
			return _level;
		}
		
		/**
		 * @private
		 */
		public function set level(value:int):void
		{
			_level = value;
		}
		
		/**
		 * 技能说明
		 */
		public function get comments():String
		{
			return _comments;
		}
		
		/**
		 * @private
		 */
		public function set comments(value:String):void
		{
			_comments = value;
		}
		
		/**
		 * 自动释放
		 */
		public function get auto():Boolean
		{
			return _auto;
		}
		
		/**
		 * @private
		 */
		public function set auto(value:Boolean):void
		{
			_auto = value;
		}
	
		//************************************************************
		//等级属性
		//***********************************************************
		
		/**
		 * 影响特效
		 */
		public function get effect():String
		{
			return _effect;
		}
		
		/**
		 * @private
		 */
		public function set effect(value:String):void
		{
			_effect = value;
		}
		
		/**
		 * 使用消耗
		 */
		public function get cast():int
		{
			return _cast;
		}
		
		/**
		 * @private
		 */
		public function set cast(value:int):void
		{
			_cast = value;
		}
		
		/**
		 * 等待时间
		 */
		public function get waitTime():int
		{
			return _waitTime;
		}
		
		/**
		 * @private
		 */
		public function set waitTime(value:int):void
		{
			_waitTime = value;
		}
		
		/**
		 * 技能持续时间
		 */
		public function get continueTime():int
		{
			return _continueTime;
		}
		
		/**
		 * @private
		 */
		public function set continueTime(value:int):void
		{
			_continueTime = value;
		}
		
		/**
		 * 影响范围
		 */
		public function get effectRange():int
		{
			return _effectRange;
		}
		
		/**
		 * @private
		 */
		public function set effectRange(value:int):void
		{
			_effectRange = value;
		}
		
		/**
		 * 影响目标类型
		 */
		public function get effectTarget():String
		{
			return _effectTarget;
		}
		
		/**
		 * @private
		 */
		public function set effectTarget(value:String):void
		{
			_effectTarget = value;
		}
		
		/**
		 * 冷却时间
		 */
		public function get cooldown():int
		{
			return _cooldown;
		}
		
		/**
		 * @private
		 */
		public function set cooldown(value:int):void
		{
			_cooldown = value;
		}
		
		/**
		 * 最大释放距离
		 */
		public function get maxCastSkillDistance():int
		{
			return _maxCastSkillDistance;
		}
		
		/**
		 * @private
		 */
		public function set maxCastSkillDistance(value:int):void
		{
			_maxCastSkillDistance = value;
		}
		
		/**
		 * 最小释放距离
		 */
		public function get miniCastSkillDistance():int
		{
			return _miniCastSkillDistance;
		}
		
		/**
		 * @private
		 */
		public function set miniCastSkillDistance(value:int):void
		{
			_miniCastSkillDistance = value;
		}

		/**
		 * 上次使用时间刻度
		 */
		public function get lastUseTime():Number
		{
			return _lastUseTime;
		}

		/**
		 * @private
		 */
		public function set lastUseTime(value:Number):void
		{
			_lastUseTime = value;
		}

		/**
		 * 释放目标类型
		 */
		public function get spellTarget():String
		{
			return _spellTarget;
		}

		/**
		 * @private
		 */
		public function set spellTarget(value:String):void
		{
			_spellTarget = value;
		}

		/**
		 * 影响间隔
		 */
		public function get effectInterval():int
		{
			return _effectInterval;
		}

		/**
		 * @private
		 */
		public function set effectInterval(value:int):void
		{
			_effectInterval = value;
		}
		
		/**
		 * 释放类型
		 */
		public function get release():String
		{
			return _release;
		}
		
		/**
		 * @private
		 */
		public function set release(value:String):void
		{
			_release = value;
		}
		
		/**
		 * 释放者所播放的动画动作
		 */
		public function get actAnim():String
		{
			return _actAnim;
		}
		
		/**
		 * @private
		 */
		public function set actAnim(value:String):void
		{
			_actAnim = value;
		}
		
		/**
		 * 参数
		 */
		public function get parameter():String
		{
			return _parameter;
		}
		
		public function set parameter(value:String):void
		{
			_parameter = value;
		}

		public function get description():String
		{
			return _description;
		}

		public function set description(value:String):void
		{
			_description = value;
		}

		/**
		 * 第二个参数
		 */
		public function get parameter1():int
		{
			return _parameter1;
		}

		public function set parameter1(value:int):void
		{
			_parameter1 = value;
		}

		/**
		 * 是否被动技能
		 */
		public function get passive():Boolean
		{
			return _passive;
		}

		public function set passive(value:Boolean):void
		{
			_passive = value;
		}

		
		//***********************************
		private var _abilityID:String;//技能id
		private var _category:String;//技能类别(单位技能，建筑技能。。);
		private var _release:String;//施法类型
		private var _actAnim:String;//释放的行动动作
		private var _name:String;//技能名称
		private var _model:String;//技能模型
		private var _animProps:Array;
		private var _icon:String;//技能icon
		private var _level:int;//技能等级
		private var _comments:String;//技能说明
		private var _auto:Boolean;//自动释放
		private var _passive:Boolean;//是否被动技能
		
		private var _miniCastSkillDistance:int;//最小释放距离
		private var _maxCastSkillDistance:int;//最大释放距离
		private var _cooldown:int;//冷却时间
		private var _parameter:String;//弹道
		private var _spellTarget:String;//释放目标类型
		private var _effectInterval:int;//影响间隔
		private var _effectTarget:String;//影响目标类型
		private var _effectRange:int;//影响范围
		private var _continueTime:int;//持续时间
		private var _waitTime:int;//等待时间
		private var _cast:int;//使用消耗
		private var _effect:String;//影响特效
		private var _effects:Array;//影响
		private var _parameter1:int;//弹道速度
		private var _description:String;//描述
		
		private var _lastUseTime:Number=0;//上次使用时间刻度
	}
}